/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __FILESYSTEM_FILE_H
#define __FILESYSTEM_FILE_H

#include <NoCopy.h>
#include <filesystem/String.hpp>

namespace liba
{

namespace filesystem
{

class File : private Nocopy
{
	struct Impl;
	Impl * impl;
	
public:

	enum Mode
	{
		READ,
		WRITE,
		APPEND
	};

	File(const filesystem::String & name, Mode mode);
	~File();
	
	bool is_valid()const;
	bool operator!()const	{return !is_valid();}
	size_t write(const void * data, size_t count);
	size_t read(void * data, size_t count);
	size_t skip(size_t count);
	size_t get_size()const;
	size_t get_position()const;
	void reset(size_t position);
	void flush();
};

} // namespace filesystem
} // namespace liba
using namespace liba;

#endif

